﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1.Helper
{
    public static class FileHelper
    {
        /// <summary>
        /// 读取area.json文件中的内容
        /// </summary>
        /// <returns></returns>
        public static string ReadJsonFile()
        {
            //var lines = File.ReadAllLines("/Resources/area.json");
            //StringBuilder jsonStr = new StringBuilder();
            //for (int i = 0; i < lines.Length; i++)
            //{
            //    jsonStr.Append(lines[i]);
            //}
            //return jsonStr.ToString();

            Assembly assm = Assembly.GetExecutingAssembly();
            Stream istr = assm.GetManifestResourceStream("RoleSelection.Resources.area.json");
            System.IO.StreamReader sr = new System.IO.StreamReader(istr);
            string str = sr.ReadToEnd();
            return str;
        }
    }
}
